/*
 * TCSS 422 - Spring quarter 2011
 * Team: 	Googlers
 * Members: Deepa Sahni, Krisnil Gounder, Michael Schweiger
 * Date: 	April 8, 2011
 */
package web;

import java.util.Collections;
import java.util.Set;

import ui.Reporter;

/**
 * A simple parser that examines the input string for matches to parameters given.
 * @author Michael Schweiger
 * @version 1.0
 */
public final class Gatherer implements Runnable{

	/**
	 * The set of terms that we are looking for.
	 */
	private final Set<String> terms;
	
	/**
	 * The text to search within.
	 */
	private final String text;
	
	/**
	 * The reporter to send data to.
	 */
	private Reporter my_reporter;
	
	/**
	 * The constructor that takes a set of terms to search for and the string to search
	 * within.
	 * @param the_terms The terms to search for, may not be null.
	 * @param the_text The text to search, may not be null.
	 * @param reporter The reporter to use for data reporting.
	 * @throws IllegalArgumentException if any parameter is null.
	 */
	public Gatherer(final Set<String> the_terms, final String the_text,
			Reporter reporter) throws IllegalArgumentException {
		if (the_terms == null) {
			throw new IllegalArgumentException("The terms set cannot be null!");
		} else if (the_text == null) {
			throw new IllegalArgumentException("The text cannot be null!");
		} else if (reporter == null) {
			throw new IllegalArgumentException("The reporter cannot be null!");
		}
		terms = Collections.unmodifiableSet(the_terms);
		text = the_text;
		my_reporter = reporter;
	}
	
	/**
	 * Starts the parsing.
	 */
	public void run() {
		// TODO Auto-generated method stub
		
	}
	
	/**
	 * Parses the text given and passes it to the Reporter that was provided upon
	 * instantiation.
	 */
	public void parse() {
		//implement me!
	}

}
